#include "ROMData.h"

unsigned short RomStringAddr[ROMSTRADDRCNT] = { 0x9FF8, 0xD2B2, 0xDFF8, 0xBFF8, 0xC7F8, 0xAFF8 };	// shawn 2009/05/04 add 232R0 v1

unsigned int uiRomID = 0;

ROM_INFO RomInfo[ROMCOUNT] =
{
	{ 0x9FF8, { 0x32, 0x32, 0x30, 0x52, 0x30, 0x01, 0x00, 0x00 }, 0x03C5,	// 220R0 (21x, 21xA, 21xB)
	0x0000, 0x0000, 40 * 1024, true, false, false, false, false, false },
	{ 0x9FF8, { 0x32, 0x32, 0x35, 0x52, 0x30, 0x03, 0x00, 0x00 }, 0x031D,	// 225R0
	0x0000, 0x01E8, 40 * 1024, true, false, false, false, false, false },
	{ 0x9FF8, { 0x32, 0x35, 0x30, 0x52, 0x30, 0x01, 0x00, 0x00 }, 0x0530,	// 250R0 v1
	0x0000, 0x01E8, 40 * 1024, false, false, false, false, false, false },
	{ 0x9FF8, { 0x32, 0x35, 0x30, 0x52, 0x30, 0x02, 0x00, 0x00 }, 0x05F0,	// 250R0 v2 and new version
	0x0000, 0x01E8, 40 * 1024, true, false, false, false, false, false },
	{ 0xD2B2, { 0x32, 0x33, 0x30, 0x52, 0x30, 0x01, 0x00, 0x00 }, 0x0530,	// 230R0 v1
	0x0000, 0x01E8, 56 * 1024, false, false, false, false, false, false },
	{ 0xDFF8, { 0x32, 0x33, 0x30, 0x52, 0x30, 0x02, 0x00, 0x00 }, 0x05E0,	// 230R0 v2
	0x0000, 0x01E8, 56 * 1024, false, true, false, false, false, false },
	{ 0xDFF8, { 0x32, 0x33, 0x30, 0x52, 0x30, 0x03, 0x00, 0x03 }, 0x05F0,	// 230R0 v3 and new version
	0x0000, 0x01E8, 56 * 1024, true, true, false, false, false, false },
	{ 0xDFF8, { 0x32, 0x33, 0x31, 0x52, 0x30, 0x01, 0x00, 0x01 }, 0x05F0,	// 231R0 v1
	0x0000, 0x01E8, 56 * 1024, false, true, false, false, false, false },
	{ 0xDFF8, { 0x32, 0x31, 0x36, 0x52, 0x30, 0x01, 0x00, 0x01 }, 0x05F0,	// shawn 2009/10/15 add 216R0
	0x0000, 0x0148, 56 * 1024, true, true, true, true, false, false },
	{ 0xBFF8, { 0x32, 0x31, 0x35, 0x52, 0x30, 0x01, 0x00, 0x00 }, 0x05F0,	// 215R0
	0x0000, 0x01E8, 48 * 1024, true, false, false, false, false, false },
	{ 0xBFF8, { 0x32, 0x33, 0x36, 0x52, 0x30, 0x01, 0x00, 0x00 }, 0x0690,	// 236R0 v1
	0x0000, 0x01E8, 48 * 1024, false, false, false, false, false, false },
	{ 0xBFF8, { 0x32, 0x33, 0x36, 0x52, 0x30, 0x02, 0x00, 0x02 }, 0x05F0,	// 236R0 v2 and new version
	0x0000, 0x01E8, 48 * 1024, true, true, false, false, false, false },
	{ 0xBFF8, { 0x32, 0x35, 0x36, 0x52, 0x30, 0x01, 0x00, 0x01 }, 0x05F0,	// 256R0 
	0x0000, 0x01E8, 48 * 1024, true, true, true, false, false, false },
	{ 0xBFF8, { 0x32, 0x33, 0x31, 0x52, 0x30, 0x02, 0x10, 0x01 }, 0x05F0,	// 231R0 v2 and new version 
	0x6000, 0x61E8, 48 * 1024, true, true, true, false, false, false },
	{ 0xBFF8, { 0x32, 0x36, 0x36, 0x52, 0x30, 0x01, 0x00, 0x01 }, 0x05F0,	// shawn 2009/05/18 add 266R0
	0x0000, 0x01E8, 48 * 1024, true, true, true, false, false, false },
	{ 0xBFF8, { 0x32, 0x37, 0x36, 0x52, 0x30, 0x01, 0x40, 0x06 }, 0x05F0,	// shawn 2009/02/18 add 276R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, false, false },
	{ 0xBFF8, { 0x32, 0x37, 0x35, 0x52, 0x30, 0x01, 0x30, 0x05 }, 0x05F0,	// shawn 2009/07/09 add 275R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, false, false },
	{ 0xBFF8, { 0x32, 0x39, 0x30, 0x52, 0x30, 0x01, 0x60, 0x07 }, 0x05F0, 	// shawn 2010/08/11 add 290R0 v1
	0x0000, 0x0148, 48 * 1024, false, true, true, true, false, false },
	{ 0xBFF8, { 0x32, 0x39, 0x30, 0x52, 0x30, 0x02, 0x61, 0x20 }, 0x05F0,	// shawn 2011/01/31 add 290R0 v2
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, false },
	{ 0xBFF8, { 0x32, 0x38, 0x36, 0x52, 0x30, 0x01, 0x41, 0x19 }, 0x05F0, 	// shawn 2010/12/30 add 286R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x38, 0x38, 0x52, 0x30, 0x01, 0x42, 0x21 }, 0x05F0, 	// shawn 2011/06/10 add 288R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x38, 0x38, 0x52, 0x30, 0x01, 0x42, 0x21 }, 0x05F0, 	// shawn 2011/08/23 add 289R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x37, 0x30, 0x52, 0x30, 0x01, 0x43, 0x22 }, 0x05F0, 	// shawn 2012/02/08 add 270R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x37, 0x31, 0x52, 0x30, 0x01, 0x43, 0x22 }, 0x05F0, 	// shawn 2012/02/08 add 271R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x38, 0x30, 0x52, 0x30, 0x01, 0x45, 0x23 }, 0x05F0,	// Daniel 2012/09/13 add 280R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xBFF8, { 0x32, 0x38, 0x31, 0x52, 0x30, 0x01, 0x45, 0x23 }, 0x05F0, 	// Daniel 2012/09/13 add 281R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xC7F8, { 0x32, 0x33, 0x32, 0x52, 0x30, 0x01, 0x20, 0x05 }, 0x05F0, 	// shawn 2009/04/03 add 232R0 v1
	0x0000, 0x0148, 56 * 1024, false, true, true, true, false, false },
	{ 0xC7F8, { 0x32, 0x33, 0x32, 0x52, 0x30, 0x02, 0x50, 0x07 }, 0x05F0, 	// shawn 2010/05/11 add 232R0 v2 (L232)
	0x0000, 0x0148, 56 * 1024, true, true, true, true, true, true },
	{ 0xAFF8, { 0x32, 0x37, 0x32, 0x52, 0x30, 0x01, 0x46, 0x25 }, 0x05F0, 	// Jyh 2015/02/05 add 272R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xAFF8, { 0x32, 0x37, 0x33, 0x52, 0x30, 0x01, 0x46, 0x25 }, 0x05F0, 	// Tzsiang 2015/06/04 add 273R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xAFF8, { 0x32, 0x37, 0x35, 0x52, 0x30, 0x01, 0x46, 0x25 }, 0x05F0, 	// Tzsiang 2015/06/04 add 275R0
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xAFF8, { 0x32, 0x38, 0x33, 0x52, 0x30, 0x01, 0x46, 0x24 }, 0x05F0, 	// wei add 283R0
	0x0000, 0x0148, 48 * 1024, false, true, true, false, true, false },
	{ 0x9FF8, { 0x32, 0x39, 0x32, 0x52, 0x30, 0x01, 0x61, 0x08 }, 0x05F0,	// 292R0 wei add 292
	0x0000, 0x0148, 48 * 1024, false, true, true, false, true, false },
	{ 0xAFF8, { 0x32, 0x38, 0x37, 0x52, 0x30, 0x01, 0x46, 0x31 }, 0x05F0,	// 287R0 wei add 287
	0x0000, 0x0148, 48 * 1024, false, true, true, false, true, false },
	{ 0xAFF8, { 0x32, 0x36, 0x37, 0x52, 0x30, 0x01, 0x46, 0x32 }, 0x05F0,   //yiling add 267
	0x0000, 0x0148, 48 * 1024, true, true, true, true, true, true },
	{ 0xAFF8, { 0x32, 0x37, 0x36, 0x52, 0x30, 0x01, 0x46, 0x35 }, 0x05F0,   //liwei add 276R0 v2
	0x0000, 0x0148, 48 * 1024, true, true, true, true, false, false },
	{ 0xAFF8, { 0x32, 0x38, 0x35, 0x52, 0x30, 0x01, 0x46, 0x36 }, 0x05F0,   //liwei add 285R0 
	0x0000, 0x0148, 48 * 1024, true, true, true, false, true, false },
	{ 0xAFF8, { 0x32, 0x38, 0x36, 0x52, 0x30, 0x01, 0x46, 0x36 }, 0x05F0,   //liwei add 286R0 
	0x0000, 0x0148, 48 * 1024, true, true, true, false, true, false }
};


DSP_ARCH_INFO g_DspArchInfo[DSP_ARCH_COUNT] = 
{
	{ 0x101f, 0x1084, 0x1073, 0x1005, 0x1006, 0x1007, 0x1080, 0x1091, 0x1082, 0x1083, 0x1081 },
	{ 0x80f0, 0x8e04, 0x8c00, 0x8200, 0x8201, 0x8202, 0x8e00, 0x8e11, 0x8e02, 0x8e03, 0x8e01 },
};

USHORT dspIdAddr = 0x101f;
USHORT sfRdyAddr = 0x1084;
USHORT usbResetAddr = 0x1073;
USHORT gpioInputAddr = 0x1005;
USHORT gpioOutputAddr = 0x1006;
USHORT gpioOEAddr = 0x1007;
USHORT sfModeAddr = 0x1080;
USHORT sfCSAddr = 0x1091;
USHORT sfWriteDataAddr = 0x1082;
USHORT sfReadDataAddr = 0x1083;
USHORT sfReadWriteTriggerAddr = 0x1081;

USHORT i2cDev = 0x10d0;
USHORT i2cMode = 0x10d9;
USHORT i2cTrg = 0x10d7;
USHORT i2cSclSelOD = 0x10d8;
USHORT i2cSlaveID = 0x10d1;
USHORT i2cDataArrStartAddr = 0x10d2;

BOOL LibUsb_SetAsicArchInfo(DSP_ARCH_TYPE dspArchType)
{
	if (dspArchType <= DAT_UNKNOW || dspArchType >= DSP_ARCH_COUNT)
		return FALSE;

	dspIdAddr = g_AsicArchInfo[dspArchType].asicIdAddr;
	sfRdyAddr = g_AsicArchInfo[dspArchType].sfRdyAddr;
	usbResetAddr = g_AsicArchInfo[dspArchType].usbResetAddr;
	gpioInputAddr = g_AsicArchInfo[dspArchType].gpioInputAddr;
	gpioOutputAddr = g_AsicArchInfo[dspArchType].gpioOutputAddr;
	gpioOEAddr = g_AsicArchInfo[dspArchType].gpioOEAddr;
	sfModeAddr = g_AsicArchInfo[dspArchType].sfModeAddr;
	sfCSAddr = g_AsicArchInfo[dspArchType].sfCSAddr;
	sfWriteDataAddr = g_AsicArchInfo[dspArchType].sfWriteDataAddr;
	sfReadDataAddr = g_AsicArchInfo[dspArchType].sfReadDataAddr;
	sfReadWriteTriggerAddr = g_AsicArchInfo[dspArchType].sfReadWriteTriggerAddr;

	i2cDev = g_AsicArchInfo[dspArchType].i2cDev;
	i2cMode = g_AsicArchInfo[dspArchType].i2cMode;
	i2cTrg = g_AsicArchInfo[dspArchType].i2cTrg;
	i2cSclSelOD = g_AsicArchInfo[dspArchType].i2cSclSelOD;
	i2cSlaveID = g_AsicArchInfo[dspArchType].i2cSlaveID;
	i2cDataArrStartAddr = g_AsicArchInfo[dspArchType].i2cDataArrStartAddr;
}

USHORT g_CurDspExtendUnitID = 0x300;

DSP_ARCH_INFO g_AsicArchInfo[DSP_ARCH_COUNT] = 
{
	{ 0x101f, 0x1084, 0x1073, 0x1005, 0x1006, 0x1007, 0x1080, 0x1091, 0x1082, 0x1083, 0x1081, 
		0x10d0, 0x10d9, 0x10d7, 0x10d8, 0x10d1, 0x10d2},
	{ 0x80f0, 0x8e04, 0x8c00, 0x8200, 0x8201, 0x8202, 0x8e00, 0x8e11, 0x8e02, 0x8e03, 0x8e01, 
		0x8600, 0x8609, 0x8607, 0x8608, 0x8601, 0x8602},
};
